{% extends 'layout/base.html' %}

{% block content %}
<div class="row mt-5">
    <div class="col-lg-3"></div>
    <div class="col-lg">
        <div class="card">
            <div class="card-header">{{ 'Edit' if alias_id > 0 else 'Create' }} Alias</div>
            <div class="card-body">
                <form action="{{ url_for('dns.alias_edit_save', alias_id=alias_id) }}" method="post">
                    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

                    <div class="form-group">
                        <label for="ip">IP Address</label>
                        <input type="text" name="ip" id="ip" class="form-control" value="{{ alias.ip if alias_id > 0 else autofill_ip }}" required autofocus>
                    </div>

                    <div class="form-group">
                        <label for="name">Name</label>
                        <input type="text" name="name" id="name" class="form-control" value="{{ alias.name if alias_id > 0 }}" required placeholder="TV, mobile, laptop, oven">
                    </div>

                    <div class="form-group">
                        <button type="submit" class="btn btn-block btn-primary">save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="col-lg-3"></div>
</div>

{% endblock %}